package com.kewu.common.enums;

import com.kewu.common.global.ResponseData;
import lombok.Getter;

@Getter
public enum ErrorCodeEnum implements IErrorEnum {

    SUCCESS("200", "成功"),
    NOT_SUPPORT_METHOD("400", "不支持的Http Method"),
    PARAM_NOT_READEABLE("401", "参数解析失败，请核对参数格式是否正确"),
    NOT_FOUND("404", "接口不存在"),
    SYSTEM_ERROR("500", "系统开小差了"),
    SIGN_INVALID("501", "签名验证失败"),
    PARAM_ILLEGAL("600", "参数非法"),
    CAPTCHA_ILLEGAL("601", "验证码有误"),
    CAPTCHA_EXPIRED("602", "验证码已过期"),
    REQUEST_FREQUENTLY("700", "请求频繁"),
    USER_VERIFYCODE_EXPIRE("11005", "验证码已过期，请重新获取!"),
    USER_STOP("16006", "用户已停用"),
    LOGIN_ERROR_TIME_REMAINING("20001", "账号将锁定24小时"),
    LOGIN_FAIL("20002", "用户名或密码错误，请重新输入，如果错误输入%s次，账号将锁定24小时！"),
    PWD_FAIL("20003", "密码错误！"),
    EXCEL_MAX_ROWS("30000", "导入记录超过限制"),
    UPLOAD_FAIL("40000", "文件上传失败"),
    DOWNLOAD_FAIL("40000", "获取文件失败"),
    FILE_NOT_PERMIT("40001", "无权限访问文件"),
    UPLOAD_MAX("40002", "附件上传超过限制%s个"),
    USER_EXISTS("10000000", "用户已存在"),
    SMS_CODE_ERROR("10000001", "短信验证码不正确"),
    SMS_CODE_ERROR_MAX("10000002", "短信验证码错误次数达到最大次数"),
    SMS_SEND_FAIL("10000003", "短信验证码发送失败"),
    GENERATE_TOKEN_FIAL("10000005", "生产token失败"),
    PARSE_TOKEN_FIAL("10000006", "解析token失败"),
    TOKEN_NOT_EXIST("10000007", "token不存在"),
    USER_NOT_EXIST("10000008", "用户不存在"),
    SEND_HTTP_ERROR("20000003", "发送http请求错误"),
    MQT_API_ERROR("50001", "绵企通接口异常"),
    MQT_API_GET_USER_NULL("50002", "检测绵企通用户响应无数据"),

    USER_TOKEN_INVALID("USER_TOKEN_INVALID", "token无效"),
    USER_TOKEN_KICK("USER_TOKEN_KICK", "您的账号在其他设备登陆，当前账号退出登陆！"),

    FILE_EXTENSION_ERROR("60001", "文件格式错误"),

    DATA_IS_EXIST("10016", "数据已经存在"),
    DATA_NOT_EXIST("10016", "数据不存在"),
    ;

    String errCode;
    String errMsg;

    ErrorCodeEnum(String errCode, String errMsg) {
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public String getErrCode() {
        return this.errCode;
    }

    public String getErrMsg() {
        return this.errMsg;
    }


    public ResponseData resp() {
        return ResponseData.error(this.getErrCode(), this.getErrMsg());
    }

    public ResponseData resp(String errMsg) {
        return ResponseData.error(this.getErrCode(), errMsg);
    }
}
